package com.ytjj.qmyx.admin.service.impl;

import com.ytjj.qmyx.admin.dao.ReturnRegisterNoteDao;
import com.ytjj.qmyx.admin.service.MemberService;
import com.ytjj.qmyx.admin.service.ReturnRegisterNoteService;
import com.ytjj.qmyx.mall.model.ReturnRegisterNote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 *
 * 
 * @Version: 1.0
 */
@Service
public class ReturnRegisterNoteServiceImpl implements ReturnRegisterNoteService {

    @Autowired
    private ReturnRegisterNoteDao returnRegisterNoteDao;

    @Autowired
    private MemberService memberService;

    @Override
    public List<ReturnRegisterNote> getNotes(Integer returnRegisterId) {
        return returnRegisterNoteDao.getNotes(returnRegisterId);
    }

    @Override
    public Integer insertNote(ReturnRegisterNote returnRegisterNote) {
        returnRegisterNote.setAdminName(memberService.getAdmin().getName());
        returnRegisterNote.setCreateTime(new Date());
        return returnRegisterNoteDao.insertNote(returnRegisterNote);
    }

}
